{% from "macros/general.html" import load_jquery %}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>{% block title %}{%endblock%}</title>

    {# CSS #}
    <link rel="stylesheet" type="text/css" href="{{ctx.homepath}}/static/{{skin}}/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="{{ctx.homepath}}/static/{{skin}}/css/screen.css" />
    <link rel="stylesheet" type="text/css" href="{{ctx.homepath}}/static/{{skin}}/css/fancybox.css" />

    <!--[if IE 7]>
        <link rel="stylesheet" type="text/css" href="{{ctx.homepath}}/static/{{skin}}/css/ie7.css" />
    <![endif]-->

    {% block extraHeader %}{% endblock extraHeader %}
</head>

<body>
    <div class="pagetop">
        <div class="head pagesize">{# -- head layout -- #}
            <div class="head_top">
                <div class="topbuts">
                    <ul class="clear">
                        <li><a href="{{ctx.homepath}}/profile/admin/general/{{session.get('username')}}" title="{{ _('Edit your profile') }}">{{ _('Preferences') }}</a></li>
                        <li><a href="{{ctx.homepath}}/logout" class="red">{{ _('Logout') }}</a></li>
                    </ul>

                    <div class="user clear">
                        <span class="user-detail">
                            <span class="text">{{ _('Logged in as %s') |format(session.get('username')) }}</span>
                        </span>
                    </div>
                </div>

                <div class="logo clear">
                    <a href="{{ctx.homepath}}/" title="View dashboard">
                        {# -- Logo Image -- #}
                        {#
                        <img src="{{ctx.homepath}}/static/logo.png" alt="" class="picture" />
                        #}
                        <span class="textlogo">
                            <span class="title">iRedAdmin</span>
                            <span class="text">{{_('iRedMail Admin Panel') }}</span>
                        </span>
                    </a>
                </div>
            </div> <!-- *** End head_top *** -->

            <div class="menu"><!-- menu -->
                <ul class="clear">
                    <li {% block navlinks_active_dashboard %}{% endblock %}><a href="{{ctx.homepath}}/dashboard">{{ _('Dashboard') }}</a></li>
                    <li {% block navlinks_active_domains %}{% endblock %}><a href="{{ctx.homepath}}/domains">{{ _('Domains and Accounts') }}</a></li>
                    {# Display extra menus for global admin. #}
                    {% if session.get('domainGlobalAdmin') is sameas true %}
                        <li {% block navlinks_active_admins %}{% endblock %}><a href="{{ctx.homepath}}/admins">{{ _('Admins') }}</a></li>
                    {% endif %}
                    <li {% block navlinks_active_system %}{% endblock %}><a href="#">{{ _('System') }}</a>
                        <ul>
                            <li><a href="{{ctx.homepath}}/system/log">{{ _('Admin Log') }}</a></li>
                        </ul>
                    </li>
                    <li {% block navlinks_active_create %}{% endblock %}>
                        <a href="#"><img src="{{ctx.homepath}}/static/{{skin}}/images/ico_add_12.png" /> {{ _('Add account') }}</a>
                        <ul>
                            {% if session.get('domainGlobalAdmin') is sameas true %}
                            <li><a href="{{ctx.homepath}}/create/domain">{{ _('Domain') }}</a></li>
                            <li><a href="{{ctx.homepath}}/create/admin">{{ _('Admin') }}</a></li>
                            {% endif %}

                            <li><a href="{{ctx.homepath}}/create/user">{{ _('User') }}</a></li>
                        </ul>
                    </li>
                </ul>
            </div> <!-- End menu -->

        </div> <!-- End head layout -->
    </div><!-- End page top -->

    {% block breadcrumb %}{% endblock %}

    <div class="main pagesize"> <!-- *** mainpage layout *** -->
        <div class="main-wrap">
            <div class="page clear">
                {% block crumb_top %}{% endblock %}

                {#-- Main page content --#}
                {% block main %}{% endblock %}

            </div>{# -- End .page .clear -- #}
        </div>{# -- End .main-wrap -- #}
    </div>{# -- End .main .pagesize -- #}

    {# Page footer #}
    {% block footer %}
    <div class="footer">
        <div class="pagesize clear">
            <p class="bt-space0">
                &copy 2010 <a target="_blank" href="http://www.iredmail.org/">iRedMail Project</a>
                {% if session.get('domainGlobalAdmin') is sameas true %}
                    | <a href="http://www.iredmail.org/forum/feed-rss-forum4.xml" target="_blank"><img src="{{ctx.homepath}}/static/{{skin}}/images/feed-icon.png" style="vertical-align: middle;" /></a>&nbsp;<a href="http://www.iredmail.org/forum/forum4-news-announcements.html" target="_blank">{{ _('News & Announments') }}</a>
                    | <a target="_blank" href="http://www.iredmail.org/forum/">{{ _('Support') }}</a>
                {% else %}
                    | <a href="mailto:{{session.get('webmaster')}}">{{ _('Contact webmaster') }}</a>
                {% endif %}
            </p>
        </div>
    </div>
    {% endblock footer %}

    {#-- Basic javascript functions. --#}
    <script type="text/javascript">
        function changeUrl(domain, baseurl) {
            if ( domain.options[domain.selectedIndex].value != 'none' ) {
                location.href = baseurl + domain.options[domain.selectedIndex].value;
            }
        }
    </script>

    {#-- Load jQuery --#}
    {% block js %}
        {{ load_jquery() }}
    {% endblock js %}

    {% block body_end %}{% endblock body_end %}
</body>
</html>
